package com.lwx.leetcode.offer.dp;

/**
 * 股票买入卖出的最大利润
 */
public class Offer63 {
    public int maxProfit(int[] prices) {
        int maxProfit = 0;
        if(prices == null || prices.length == 0){
            return 0;
        }
        for (int i = 0; i < prices.length; i++) {
            for (int j = i+1; j < prices.length; j++) {
                if(prices[j] - prices[i] > maxProfit){
                    maxProfit = prices[j] - prices[i];
                }
            }
        }
        return maxProfit;
    }
}
